<?php

/**
 * This is the model class for table "general_information".
 *
 * The followings are the available columns in table 'general_information':
 * @property integer $id
 * @property integer $building_permit_no
 * @property string $bpn_date_issued
 * @property integer $occupancy_permit_no
 * @property string $opn_date_issued
 * @property string $other_information
 * @property integer $latest_fsic_issued_control_no
 * @property string $ficn_date_issued
 * @property integer $ficn_fc_fee
 * @property integer $total_floor_area_occupied
 * @property string $certificate_of_fire_drill
 * @property string $cofd_date_issued
 * @property integer $cofd_fc_fee
 * @property integer $latest_notice_to_correct_violation_control_no
 * @property string $ntcvcn_date_issued
 * @property string $name_of_fire_insurance_co_insurer
 * @property integer $policy_no
 * @property string $nofic_date_issued
 * @property string $latest_mayor_or_business_permit
 * @property string $mobp_date_issued
 * @property integer $municipal_license_no
 * @property string $mln_date_issued
 * @property integer $latest_certificate_of_electrical_inspection_no
 * @property string $coein_date_issued
 * @property integer $inspection_id
 *
 * The followings are the available model relations:
 * @property Inspection $inspection
 */
class GeneralInformation extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return GeneralInformation the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'general_information';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('inspection_id', 'required'),
			array('building_permit_no, occupancy_permit_no, latest_fsic_issued_control_no, ficn_fc_fee, total_floor_area_occupied, cofd_fc_fee, latest_notice_to_correct_violation_control_no, policy_no, municipal_license_no, latest_certificate_of_electrical_inspection_no, inspection_id', 'numerical', 'integerOnly'=>true),
			array('name_of_fire_insurance_co_insurer', 'length', 'max'=>45),
			array('bpn_date_issued, opn_date_issued, other_information, ficn_date_issued, certificate_of_fire_drill, cofd_date_issued, ntcvcn_date_issued, nofic_date_issued, latest_mayor_or_business_permit, mobp_date_issued, mln_date_issued, coein_date_issued', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, building_permit_no, bpn_date_issued, occupancy_permit_no, opn_date_issued, other_information, latest_fsic_issued_control_no, ficn_date_issued, ficn_fc_fee, total_floor_area_occupied, certificate_of_fire_drill, cofd_date_issued, cofd_fc_fee, latest_notice_to_correct_violation_control_no, ntcvcn_date_issued, name_of_fire_insurance_co_insurer, policy_no, nofic_date_issued, latest_mayor_or_business_permit, mobp_date_issued, municipal_license_no, mln_date_issued, latest_certificate_of_electrical_inspection_no, coein_date_issued, inspection_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'inspection' => array(self::BELONGS_TO, 'Inspection', 'inspection_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'building_permit_no' => 'Building Permit No',
			'bpn_date_issued' => 'Bpn Date Issued',
			'occupancy_permit_no' => 'Occupancy Permit No',
			'opn_date_issued' => 'Opn Date Issued',
			'other_information' => 'Other Information',
			'latest_fsic_issued_control_no' => 'Latest Fsic Issued Control No',
			'ficn_date_issued' => 'Ficn Date Issued',
			'ficn_fc_fee' => 'Ficn Fc Fee',
			'total_floor_area_occupied' => 'Total Floor Area Occupied',
			'certificate_of_fire_drill' => 'Certificate Of Fire Drill',
			'cofd_date_issued' => 'Cofd Date Issued',
			'cofd_fc_fee' => 'Cofd Fc Fee',
			'latest_notice_to_correct_violation_control_no' => 'Latest Notice To Correct Violation Control No',
			'ntcvcn_date_issued' => 'Ntcvcn Date Issued',
			'name_of_fire_insurance_co_insurer' => 'Name Of Fire Insurance Co Insurer',
			'policy_no' => 'Policy No',
			'nofic_date_issued' => 'Nofic Date Issued',
			'latest_mayor_or_business_permit' => 'Latest Mayor Or Business Permit',
			'mobp_date_issued' => 'Mobp Date Issued',
			'municipal_license_no' => 'Municipal License No',
			'mln_date_issued' => 'Mln Date Issued',
			'latest_certificate_of_electrical_inspection_no' => 'Latest Certificate Of Electrical Inspection No',
			'coein_date_issued' => 'Coein Date Issued',
			'inspection_id' => 'Inspection',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('building_permit_no',$this->building_permit_no);
		$criteria->compare('bpn_date_issued',$this->bpn_date_issued,true);
		$criteria->compare('occupancy_permit_no',$this->occupancy_permit_no);
		$criteria->compare('opn_date_issued',$this->opn_date_issued,true);
		$criteria->compare('other_information',$this->other_information,true);
		$criteria->compare('latest_fsic_issued_control_no',$this->latest_fsic_issued_control_no);
		$criteria->compare('ficn_date_issued',$this->ficn_date_issued,true);
		$criteria->compare('ficn_fc_fee',$this->ficn_fc_fee);
		$criteria->compare('total_floor_area_occupied',$this->total_floor_area_occupied);
		$criteria->compare('certificate_of_fire_drill',$this->certificate_of_fire_drill,true);
		$criteria->compare('cofd_date_issued',$this->cofd_date_issued,true);
		$criteria->compare('cofd_fc_fee',$this->cofd_fc_fee);
		$criteria->compare('latest_notice_to_correct_violation_control_no',$this->latest_notice_to_correct_violation_control_no);
		$criteria->compare('ntcvcn_date_issued',$this->ntcvcn_date_issued,true);
		$criteria->compare('name_of_fire_insurance_co_insurer',$this->name_of_fire_insurance_co_insurer,true);
		$criteria->compare('policy_no',$this->policy_no);
		$criteria->compare('nofic_date_issued',$this->nofic_date_issued,true);
		$criteria->compare('latest_mayor_or_business_permit',$this->latest_mayor_or_business_permit,true);
		$criteria->compare('mobp_date_issued',$this->mobp_date_issued,true);
		$criteria->compare('municipal_license_no',$this->municipal_license_no);
		$criteria->compare('mln_date_issued',$this->mln_date_issued,true);
		$criteria->compare('latest_certificate_of_electrical_inspection_no',$this->latest_certificate_of_electrical_inspection_no);
		$criteria->compare('coein_date_issued',$this->coein_date_issued,true);
		$criteria->compare('inspection_id',$this->inspection_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}